MessageDlg
Result = MessageDlg(Icon, Title$, Text$, Info$, ButtonText$, CancelBtn, [DefaultBtn], [ShowCheckBox])
 
Parameters:

    Title$=the title of the dialog
    Text$=the actualy message
    Info$=additional information
    ButtonText$=the text of the buttons
    [Icon]=the icon of the message dialog
    [CancelBtn]=the button number returned if the user presses ESC
    [DefaultBtn]=the default button
    [ShowCheckBox]=whether or not a checkbox will be displayed
Returns:

    Result=the button the user pressed
 

     MessageDlg displays a modern messagebox. You can freely define the text of the buttons and optionally show a checkbox. To set the text of the checkbox, call the SetMessageDlgCheckBoxText command beforehand.
This function will return the button the user clicked, numbering from left to right. So if there are three buttons in a dialog, the leftmost button will return with 1, the one in the middle 2 and the right one 3.

     * Title$ = the text that goes in the title bar of the dialog window
     * Text$ = the text of the message dialog
     * Info$ = additional info text that is displayed below the message text
     * ButtonText$ = the text for the buttons to be displayed. Seperate each button with a "|" character
     * [Icon] = specifies the icon to be displayed (see below). This parameter is optional and defaults to 0 = no icon.
     * [CancelBtn] = the button number that is returned if the user presses the escape key or closes the box with the close button on the top right corner. If this value is 0, there is no cancel button defined and the dialog won't display a close button and will also not close if the user presses the escape key. This is an optional parameter and defaults to 0.
      * DefaultBtn = the default button is the button number that will return if the user presses the Enter key before any other key in the dialog. It also has a visible margin. By default the first button (on the left-hand side) button is the default button.
     * ShowCheckbox = set it to 1 if you want to display a checkbox in the dialog. Usually this is used for "Don*t show this message again." or similar. By default it is set to 0, meaning no checkbox is shown.

You can show different icons on the left-hand side of the dialog. There are five pre-defined constsnts in the library:
     * MD_Icon_None = no icon
     * MD_Style_Warning = an exclamation mark
     * MD_Style_Question = a question mark
     * MD_Style_Error = a cross in a red circle
     * MD_Style_Info = the letter "i" in a blue circle

Seperate the button text with a "|" character for each button. So for example if you want three buttons named "Yes", "No" and "Cancel" the ButtonText would look like this: "Yes|No|Cancel"

This dialog uses the tasl dialog provided by the Windows OS on Vista an newer versions and falls back to an emulation on Windows XP.


FACTS:


      * This dialog is not asynchronous, so the PlayBasic application will halt while the dialog is open.


  
; Inlcude the Dialogs library in this program
  #Include "PBDialogs2"
  
  
  Result = MessageDlg("An example""This is the main text.""This is the info text""Ok|Wow|Nice", MD_Sytle_Info, 311)
  
  Print "You pressed button number:"
  Print result
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  




 
Related Info: GetMessageDlgCheckBoxState | GetMessageDlgCheckBoxText$ | MessageDlgCheckBoxState | MessageDlgCheckBoxText :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com